/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: Test.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/3/17 下午3:49
 * LastModified: 2020/03/17 15:49:17
 */

package com.qolome.knowledge.design.pattern.iterator.demo;

import com.qolome.knowledge.design.pattern.bridge.demo.course.ICourse;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Qolome
 * @version V1.0
 * @Description 测试类
 * @date 2020年 03月17日 15:49:12
 */
@Slf4j
public class Test {

    public static void main(String[] args) {

        Course javaCourse = new Course("Java架构");
        Course javaBase = new Course("Java基础");
        Course design = new Course("设计模式");
        Course ai = new Course("人工智能");
        ICourseAggrega aggrega = new CourseAggregaImpl();
        aggrega.add(javaCourse);
        aggrega.add(javaBase);
        aggrega.add(design);
        aggrega.add(ai);
        log.info("原始数据");
        printCourse(aggrega);
        aggrega.remove(javaCourse);
        log.info("更新后数据");
        printCourse(aggrega);
    }

    private static void printCourse(ICourseAggrega aggrega) {

        Iterator<Course> courseIterator = aggrega.iterator();
        while (courseIterator.hasNext()){
            Course course = courseIterator.next();
            log.info("课程信息:{}",course);

        }
    }
}
